#ifndef __PCDLAPLACE_H__
#define __PCDLAPLACE_H__


#include <map>
#include <vector>

#include <CGAL/basic.h>
#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/determinant.h>
#include <CGAL/iterator.h>
#include <CGAL/intersections.h>
#include <CGAL/enum.h>
#include <CGAL/IO/Geomview_stream.h>
#include <CGAL/IO/Triangulation_geomview_ostream_3.h>
#include <CGAL/Timer.h>
#include <CGAL/Origin.h>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include <float.h>


#include <CGAL/Cartesian_d.h>
#include <CGAL/Delaunay_d.h>



#define M_PI       3.14159265358979323846


#include "point_cloud.h"


typedef CGAL::Cartesian_d<double> KCd;
typedef CGAL::Point_d<KCd> dPoint;         
typedef CGAL::Vector_d<KCd> dVector;

typedef KCd::FT FT;

typedef CGAL::Delaunay_d<KCd> Triangulation_d;
typedef Triangulation_d::Point_d Point_d;
typedef Triangulation_d::Simplex_handle dSimplex_handle;
typedef Triangulation_d::Vertex_handle dVertex_handle;



void generate_laplace_matrix_sparse_matlab_dim2(
	PCloud& pcloud, double h, double rho, 
	std::vector<unsigned int>& II, 
	std::vector<unsigned int>& JJ, 
	std::vector<double>& SS);

void generate_laplace_matrix_sparse_matlab_dim3(
	PCloud& pcloud, double h, double rho, 
	std::vector<unsigned int>& II, 
	std::vector<unsigned int>& JJ, 
	std::vector<double>& SS);
void generate_laplace_matrix_sparse_matlab_dimk(
	PCloud& pcloud, double h, double rho, 
	unsigned int tdim, 
	std::vector<unsigned int>& II, 
	std::vector<unsigned int>& JJ, 
	std::vector<double>& SS);



//--------------------------------------------------------------------------------------------------------------//
//
//						Utility
//
//--------------------------------------------------------------------------------------------------------------//
void est_tangent_space_lapack(const dPoint& pt, const std::vector<dPoint>& neighbor_pts, double h, unsigned int tdim, std::vector<dVector>& tspace);
double simplex_sign_volume(std::vector<dPoint> points);









#endif